"""
    说要 json转为 字典，尽量不要用 eval
    用json模块

"""

# todo 写测试用例用双引号
import json

data_json = '{"mobilephone":"1234654","pwd":"12 3465","data":" ","expect":null}'

# 直接用eval ，遇到null会报错 NameError: name 'null' is not defined
# print(eval(data_json))

# 用json 转换为 字典
data_dict = json.loads(data_json)
print(data_dict)

# python 字典转为 JSON
mydict = {"mobilephone":"16546521","data":" ","pwd":None}
myjson = json.dumps(mydict)
print(myjson)